package com.gxnzd.communityelderly.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.gxnzd.communityelderly.commom.R;
import com.gxnzd.communityelderly.entity.Scheduling;
import com.gxnzd.communityelderly.service.SchedulingService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: SchedulingController
 * Package: com.gxnzd.communityelderly.controller
 * Description:
 *
 * @Author 胡海峰
 * @Create 2024/10/31 15:27
 * @Version 1.0
 */
@RestController
@CrossOrigin
@RequestMapping("/scheduling")
public class SchedulingController {
    @Resource
    private SchedulingService schedulingService;

    @PostMapping("/add")
    public R addScheduling(@RequestBody Scheduling scheduling){
        return schedulingService.appendScheduling(scheduling);
    }

    //根据医生id获取排班信息
    @GetMapping("/info")
    public R getSchedulingInfo(Integer empId){
        return  schedulingService.getDoctorOne(empId);
    }

    //删除此医生的排班
    @DeleteMapping("/delete/{id}")
    public R deleteScheduling(@PathVariable Long id){
        return schedulingService.clearScheduling(id);
    }

    //获取某个社区的排班
    @GetMapping("/getList/{communityId}")
    public R getList(@PathVariable Long communityId){
        return schedulingService.getCommunityList(communityId);
    }
}
